/**
 * Copyright (c) 2018, wuxie All rights reserved.
 * qq:16349023,mail:16349023@qq.com
 * 未经许可禁止任何人通过任何渠道使用、修改源代码.
 * 项目名称 : wxcloud
 *
 * @version V1.0
 */
package cn.xo68.boot.auth.server.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 *  认证服务端配置属性类
 * @author wuxie
 * @date 2018/8/4 17:35
 *
 */
@Configuration
@ConfigurationProperties("wuxie.auth.server")
public class AuthServerProperties {

    private boolean enabled;

    /**
     * 令牌缓存过期秒数,默认3小时
     */
    private int tokenExpireSeconds=60*60*12;

    /**
     * 令牌缓存命名空间
     */
    private String tokenNameSpace="token:";

    /**
     * 刷新令牌缓存过期秒数，默认24小时
     */
    private int refreshTokenExpireSeconds=60*60*24;
    /**
     * 刷新令牌缓存命名空间
     */
    private String refreshTokenNameSpace="refresh-token:";

    /**
     * 临时凭证缓存过期秒数，默认5分钟
     */
    private int authorizeCodeExpireSeconds=60*5;
    /**
     * 临时凭证缓存命名空间
     */
    private String authorizeCodeNameSpace="authorize-code:";

    /**
     * 登录地址
     */
    private String loginUrl="/login";

    /**
     * 登录成功的地址
     */
    private String successUrl="/";

    /**
     * 登录失败的地址
     */
    private String failUrl="/error/loginfail.html";

    /**
     * 没有权限的地址
     */
    private String unauthorizedUrl="/error/unauthorized.html";

    /**
     * 浏览器数据cookie name
     */
    private String browerDataCookieName="browerData";

    /**
     * cookie domain
     */
    private String cookieDomain="";

    /**
     * oauth2 令牌申请地址
     */
    private String oauth2TokenUrl="/oauth/token";
    /**
     * oauth2 授权地址
     */
    private String oauth2AuthorizeUrl="/oauth/authorize";
    /**
     * 客户端用户信息
     */
    private String clientUserInfoUrl="/client/userinfo";

    /**
     * 登录异常周期，单位：分钟，默认2小时
     */
    protected int loginFailPeriod=2*60;
    /**
     * 异常周期内最大失败次数
     */
    protected int loginFailMaxTimes=4;



    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public int getTokenExpireSeconds() {
        return tokenExpireSeconds;
    }

    public void setTokenExpireSeconds(int tokenExpireSeconds) {
        this.tokenExpireSeconds = tokenExpireSeconds;
    }

    public String getTokenNameSpace() {
        return tokenNameSpace;
    }

    public void setTokenNameSpace(String tokenNameSpace) {
        this.tokenNameSpace = tokenNameSpace;
    }


    public int getRefreshTokenExpireSeconds() {
        return refreshTokenExpireSeconds;
    }

    public void setRefreshTokenExpireSeconds(int refreshTokenExpireSeconds) {
        this.refreshTokenExpireSeconds = refreshTokenExpireSeconds;
    }

    public String getRefreshTokenNameSpace() {
        return refreshTokenNameSpace;
    }

    public void setRefreshTokenNameSpace(String refreshTokenNameSpace) {
        this.refreshTokenNameSpace = refreshTokenNameSpace;
    }

    public int getAuthorizeCodeExpireSeconds() {
        return authorizeCodeExpireSeconds;
    }

    public void setAuthorizeCodeExpireSeconds(int authorizeCodeExpireSeconds) {
        this.authorizeCodeExpireSeconds = authorizeCodeExpireSeconds;
    }

    public String getAuthorizeCodeNameSpace() {
        return authorizeCodeNameSpace;
    }

    public void setAuthorizeCodeNameSpace(String authorizeCodeNameSpace) {
        this.authorizeCodeNameSpace = authorizeCodeNameSpace;
    }

    public String getLoginUrl() {
        return loginUrl;
    }

    public void setLoginUrl(String loginUrl) {
        this.loginUrl = loginUrl;
    }

    public String getSuccessUrl() {
        return successUrl;
    }

    public void setSuccessUrl(String successUrl) {
        this.successUrl = successUrl;
    }

    public String getFailUrl() {
        return failUrl;
    }

    public void setFailUrl(String failUrl) {
        this.failUrl = failUrl;
    }

    public String getUnauthorizedUrl() {
        return unauthorizedUrl;
    }

    public void setUnauthorizedUrl(String unauthorizedUrl) {
        this.unauthorizedUrl = unauthorizedUrl;
    }


    public String getBrowerDataCookieName() {
        return browerDataCookieName;
    }

    public void setBrowerDataCookieName(String browerDataCookieName) {
        this.browerDataCookieName = browerDataCookieName;
    }

    public String getCookieDomain() {
        return cookieDomain;
    }

    public void setCookieDomain(String cookieDomain) {
        this.cookieDomain = cookieDomain;
    }

    public String getOauth2TokenUrl() {
        return oauth2TokenUrl;
    }

    public void setOauth2TokenUrl(String oauth2TokenUrl) {
        this.oauth2TokenUrl = oauth2TokenUrl;
    }

    public String getOauth2AuthorizeUrl() {
        return oauth2AuthorizeUrl;
    }

    public void setOauth2AuthorizeUrl(String oauth2AuthorizeUrl) {
        this.oauth2AuthorizeUrl = oauth2AuthorizeUrl;
    }

    public String getClientUserInfoUrl() {
        return clientUserInfoUrl;
    }

    public void setClientUserInfoUrl(String clientUserInfoUrl) {
        this.clientUserInfoUrl = clientUserInfoUrl;
    }

    public int getLoginFailPeriod() {
        return loginFailPeriod;
    }

    public void setLoginFailPeriod(int loginFailPeriod) {
        this.loginFailPeriod = loginFailPeriod;
    }

    public int getLoginFailMaxTimes() {
        return loginFailMaxTimes;
    }

    public void setLoginFailMaxTimes(int loginFailMaxTimes) {
        this.loginFailMaxTimes = loginFailMaxTimes;
    }
}
